package com.insta.playdroid;

import java.util.List;

import adapteurMediaStore.AdapteurArtistMediaStore;
import adapteurMediaStore.IAdapteurMediaStore;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

import com.insta.adapterList.ArtistAdapter;
import com.insta.playdroid.metier.domain.Artist;

public class ArtistActivity2 extends MediaPlayerNewListActivity {

	public static List<Artist> artists;
	private IAdapteurMediaStore<Artist> adapteurMediaStore;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.allsong);

		// récup l'instance du player
		player = PlayerFactory.create(0, null, this);

		// charger la liste des albums (id, titre, art)
		adapteurMediaStore = new AdapteurArtistMediaStore(getBaseContext());
		artists = adapteurMediaStore.collectAllValuesFromDB();

		// charger les items albums
		ListView lv = (ListView) findViewById(android.R.id.list);
		lv.setTextFilterEnabled(true);

		ArtistAdapter adapter = new ArtistAdapter(this, artists);
		lv.setAdapter(adapter);
		adapter.notifyDataSetChanged();
	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		Intent artistSongs = new Intent(this, ArtistSongsActivity.class);
		artistSongs.putExtra("artist", position);
		startActivity(artistSongs);

	}

}
